<?php
	require_once "DbMysql.php";
	require_once "RandomCode.php";

	const CODE_LENGTH = 12;
	const CODE_NUM = 500;

	$config = array(
				'host' => '127.0.0.1',
				'port' => '3306',
				'username' => 'root',
				// 'password' => 'root',
				'password' => 'YU0bty7A',
				'db' => 'lottery'
				);
	$db = new DB($config);

	$random_code = new RandomCode();

	$current = 0;
	$codeorder = 1;
	for ($i=0; $i < CODE_NUM; $i++) { 
		$code = $random_code->get_random_code(CODE_LENGTH);
		$data = array('uniquestr' => $code, 'codeorder' => $codeorder);
		$res = $db->insert("verification_code", $data);
		if ($res) {
			$current++;
			$codeorder++;
			echo "Current success num $current...";
			echo "<br>";
		}
	}

	$db->close();

	echo "Success...";

	
	
	
?>